#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QFileDialog>
#include <QtSql/QtSql>
#include <QSqlDatabase>
#include <QSqlQuery>

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
private slots:
    void change_MatSelection(const QModelIndex &current, const QModelIndex &previous);
    void change_TypeSelection(const QModelIndex &current, const QModelIndex &previous);
    void change_SizeSelection(const QModelIndex &current, const QModelIndex &previous);

private slots:
    void on_actionNew_triggered();
    void on_actionOpen_triggered();
    void on_pushButton_2_clicked();
    void on_actionF5_triggered();
    void on_pushButton_3_clicked();
    void on_pushButton_clicked();
    void on_lineEdit_2_textChanged(const QString &arg1);
    void on_lineEdit_3_textChanged(const QString &arg1);
    void on_lineEdit_4_textChanged(const QString &arg1);

    void on_tabWidget_currentChanged(int index);

    void on_actionSave_triggered();

private:
    Ui::MainWindow *ui;
    QSqlQuery query;
    QSqlDatabase db,temp_db;
    QString DB_path;
    QSqlRelationalTableModel *tabTable;
    QSqlTableModel *tabType,*tabSize;
    QItemSelectionModel *MatSelection,*TypeSelection,*SizeSelection;

private:
    bool init_table();
};
#endif // MAINWINDOW_H
